package com.wellgoon.test.exam;

import java.util.Scanner;

/**
 * 字符串截取
 */
public class HJ4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("[" + String.format("%08d","abc") + "]");
        System.out.println("请输入字符串：");
        try {
            while (sc.hasNext()) {
                String str = sc.nextLine();
                System.out.println("请输入字符串：");
                char[] chars = str.toCharArray();
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < chars.length; i++) {
                    sb.append(chars[i]);
                    if (sb.toString().length() == 8) {
                        System.out.println(sb.toString());
                        sb.reverse();
                        continue;
                    }
                }
                
            }
        } catch (Exception e) {

        }
    }
}
